<?php
class Database {

	const HOST = "localhost";
	const DBNAME = "gaertnerei";
	const USER = "root";
	const PASSWORD = "";

	private $connection = null;

	/**
	 * Baut die Verbindung zur Datenbank auf.
	 */
	public function __construct() {
		$this->connection = @mysql_pconnect(Database::HOST, Database::USER, Database::PASSWORD) or Core::error("Error beim Connect zur DB: " . mysql_error());
		@mysql_select_db(Database::DBNAME, $this->connection) or Core::error("Error beim Selektieren der DB: " . mysql_error());
	}


	public function sendQuery($sql){
		$erg = array();
		$i = 0;
		$result = @mysql_query($sql, $this->connection);

		while($row = mysql_fetch_array($result)){
				
			$erg[$i] = $row;
			$i++;
		}

		return $erg;

	}

}

?>